The namegen5 website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
415 B

3 years ago
  1. import names, {collection} from './_names.js';
  2. export function get(req, res) {
  3. const name = names.find(n => n.name === req.params.name);
  4. if (name == null) {
  5. res.writeHead(404, {
  6. 'Content-Type': 'application/json'
  7. });
  8. res.end(JSON.stringify({code: 404, error: "Not found"}));
  9. return;
  10. }
  11. res.writeHead(200, {
  12. 'Content-Type': 'application/json'
  13. });
  14. res.end(JSON.stringify({name, collection}));
  15. }